package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.TopDriveB223;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class TopDriveB223Converter implements AttributeConverter<TopDriveB223, String> {
    @Override
    public String convertToDatabaseColumn(TopDriveB223 topDriveB223) {
        return JSONUtil.toJsonStr(topDriveB223);
    }

    @Override
    public TopDriveB223 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, TopDriveB223.class);
    }
}
